#!/usr/bin/env bash

#get this script real directory
SOURCE="$0"
while [ -h "$SOURCE"  ]; do # resolve $SOURCE until the file is no longer a symlink
    this_script_dir="$( cd -P "$( dirname "$SOURCE"  )" && pwd  )"
    SOURCE="$(readlink "$SOURCE")"
    # if $SOURCE was a relative symlink, 
    #we need to resolve it relative to the path 
    #where the symlink file was located
    [[ $SOURCE != /*  ]] && SOURCE="$this_script_dir/$SOURCE"
done
this_script_dir="$( cd -P "$( dirname "$SOURCE"  )" && pwd  )"

log_level=${log_level:=info}
assist_dir="$(dirname $this_script_dir)/assist"
source $assist_dir/global.sh

################################################################################
#                                                                          80col
print_help()
{
    cat <<EOF
    useage:

EOF
}

main()
{
    my_log_file=$HOME/git/run/log/start_when_poweron.log
    mkdir -p $(dirname $my_log_file)
    date >> $my_log_file
    vlogi "pwd:$(pwd)" >> $my_log_file

    if [ -f $this_script_dir/../file_mgr/git_daemon.sh ] ; then
        $this_script_dir/../file_mgr/git_daemon.sh &
    fi

    if [ -d ~/git/ddns ] ; then
        ~/git/ddns/shell/reset_domain_ip.sh &
    fi

    if [ -e ~/git/tool_sh/show.sh ] ; then
        ~/git/tool_sh/show.sh --ip_upload --loop &
    fi


    return 0;
}

main || exit $? && exit 0

